package test

import (
	"TheTearAfter/models"
	"TheTearAfter/service"
	"fmt"
)

func Test() {
	initBranch(false)
}

func initBranch(run bool) {
	if !run {
		return
	}

	initMessageTypeClass := []*models.MessageTypeClass{
		{
			Name: "Sleep",
			Img:  "https://s21.ax1x.com/2024/04/10/pFXPTeK.png",
		},
		{
			Name: "Clean",
			Img:  "https://s21.ax1x.com/2024/04/10/pFXi7Xq.png",
		},
		{
			Name: "Work",
			Img:  "https://s21.ax1x.com/2024/04/10/pFXiXAU.png",
		},
		{
			Name: "Diet",
			Img:  "https://s21.ax1x.com/2024/04/10/pFXivh4.png",
		},
		{
			Name: "Sport",
			Img:  "https://s21.ax1x.com/2024/04/10/pFXiz9J.png",
		},
	}

	fmt.Println(initMessageTypeClass)
	service.MessageTypeClassUpdata(initMessageTypeClass)

	classList, _ := models.GetAllMessageTypeClass()

	fmt.Println(service.MessageBlockUpdata(classList))


	// var testQuery = component.NewMessageClawer("https://newsnetwork.mayoclinic.org/search/?search=eye&pg=%d")
	// urlList, err := testQuery.ClawUrl(3, "ch-analytics-search-result-link ch-search-result-title")
	// if err != nil {
	// 	fmt.Println("testQuery.ClawUrl err", err)
	// }

	// fmt.Println("UrlNum: ", len(urlList))
	// for _, url := range urlList {
	// 	fmt.Println(url)
	// }

	// messageList, err := testQuery.ClawMessage()
	// if err != nil {
	// 	fmt.Println("testQuery.ClawMessage err", err)
	// }

	// fmt.Println("MessageNum: ", len(messageList))
	// for _, message := range messageList {
	// 	fmt.Println(message)
	// }
}